require(["common", "hash_routie", "coAjax", "queryString", "Cookies", "href"], function(jSouper, hash_routie, coAjax, QueryString, Cookies, href) {
	//用户名缓存
	App.set("$Cache.admin.login.username", Cookies.get("cache_bus_login_name"));

	queryString = new QueryString;
	App.set("$Event.admin.login", function(argument) {
		var username = App.get("$Cache.admin.login.username");
		var password = App.get("$Cache.admin.login.password");
		coAjax.post(appConfig.bus.login, {
			name: username,
			password: password
		}, function() {
			alert("success", "商家登录成功");
			var callbackUrl = queryString.get("cb_url");
			Cookies.set("cache_bus_login_name", username);
			if (callbackUrl) {
				href.jump(callbackUrl);
			} else {
				href.jump("/admin-beta.html");
			}
		}, function(errorCode, xhr, errorMsg) {
			alert("error", errorMsg);
		})
	});
	App.set("$Event.admin.login.to_password_input",function () {
		App.set("$Cache.admin.login.is_focus_pwd",true);
		App.set("$Cache.admin.login.is_focus_pwd",false);
	});
});